Defines a generic, linked-list container.
Finalizer for the linked_list type responsible for clean-up duties when the list goes out of scope.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(linked_list), | intent(inout) | :: | this |
The linked_list object. |
Clears the entire list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(inout) | :: | this |
The linked_list object. |
Gets the number of items in the list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(in) | :: | this |
The linked_list object. |
Gets the current item.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(in) | :: | this |
The linked_list object. |
The currently referenced item from the list. This may be null if the list is empty.
Moves the current position in the list to the first item.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(inout) | :: | this |
The linked_list object. |
Moves the current position in the list to the last item.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(inout) | :: | this |
The linked_list object. |
Moves to the next item in the list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(inout) | :: | this |
The linked_list object. |
Returns true if the move was successful; else, returns false. Typically a false value indicates the end of the list; however, a false value can be encountered if the list is emtpy.
Pops an item off the back of the list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(inout) | :: | this |
The linked_list object. |
Moves to the previous item in the list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(inout) | :: | this |
The linked_list object. |
Returns true if the move was successful; else, returns false. Typically a false value indicates the end of the list; however, a false value can be encountered if the list is emtpy.
Pushes an item onto the end of the list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(inout) | :: | this |
The linked_list object. |
||
| class(*), | intent(in), | target | :: | x |
The object to store. |
|
| logical, | intent(in), | optional | :: | manage |
An optional input used to determine if the list should manage memory for this object. If set to true a clone of x is stored and the list will handle management of resources held by the clone. If false, the list will not manage resources held by x and x itself will be stored. Notice, in this manner it is possible for x to go out of scope while the list still persists thereby resulting in a potentially undefined behavior. It is recommended to use the default value of true except for very specific and well controlled edge cases. |
Replaces the current item in the list with the supplied item.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linked_list), | intent(inout) | :: | this |
The linked_list object. |
||
| class(*), | intent(in), | target | :: | x |
The object to store. |
|
| logical, | intent(in), | optional | :: | manage |
An optional input used to determine if the list should manage memory for this object. If set to true a clone of x is stored and the list will handle management of resources held by the clone. If false, the list will not manage resources held by x and x itself will be stored. Notice, in this manner it is possible for x to go out of scope while the list still persists thereby resulting in a potentially undefined behavior. It is recommended to use the default value of true except for very specific and well controlled edge cases. |